package com.maoye.ossp.bpm.example.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hotent.base.db.api.Dao;
import com.maoye.ossp.bpm.example.dao.IBusFormDao;
import com.maoye.ossp.bpm.example.entity.BusForm;
import com.maoye.ossp.bpm.example.service.IBusFormService;
import com.maoye.ossp.bpm.workflow.service.IProcessService;
import com.maoye.ossp.common.service.BaseServiceImpl;

/**
 * 学生Service实现类
 * 
 * @author zhuangwl
 * @date 2013-12-16
 * @version 1.0
 */
@Service("busFormService")
public class BusFormServiceImpl extends BaseServiceImpl<Long, BusForm> implements IBusFormService {

	@Resource
	IBusFormDao busFormDao;

	@Resource
	IProcessService processService;

	@Override
	protected Dao<Long, BusForm> getDao() {
		return busFormDao;
	}

	@Override
	public void create(BusForm busForm) {

		super.create(busForm);
		// 如果等于1 提交流程
		if (busForm.getIntro().equals("1")) {
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("testform", "12");
			processService.executeWorkFlow(busForm.getId().toString(), params);
		}

	}

	@Override
	public void update(BusForm busForm) {
		super.update(busForm);
		// 如果等于1 提交流程
		if (busForm.getIntro().equals("1")) {
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("abc", "12");
			processService.executeWorkFlow(busForm.getId().toString(), params);
		}
	}

}
